﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DriveBabyDrive.Models;
using System.Web.Security;

namespace DriveBabyDrive.Controllers
{
    public class HomeController : Controller
    {
        [Authorize]
        public ActionResult Index()
        {
            string browserAgent = Request.UserAgent.ToString().ToLower();
            if (!(browserAgent.Contains("android") || browserAgent.Contains("iphone")))
            {
                return RedirectToAction("DesktopHome");
            }
            
            return View();
            
        }
        public ActionResult About()
        {
            ViewBag.Message = "Your quintessential app description page.";

            return View();
        }
        public ActionResult Contact()
        {
            ViewBag.Message = "Your quintessential contact page.";

            return View();
        }
        [AllowAnonymous]
        public ActionResult DesktopHome()
        {
            ViewBag.Browser = Request.Browser.Browser.ToString();
            ViewBag.isMobileDevice = Request.Browser.IsMobileDevice.ToString();
            ViewBag.UserAgent = Request.UserAgent.ToString() == "" ? "Empty" : Request.UserAgent.ToString();
            return View();
        }
        public bool MemberShip { get; set; }
    }
}
